package com.its.common.disruptor.consumer;

import com.its.common.disruptor.dto.TranslatorDataWapper;
import com.lmax.disruptor.WorkHandler;

/**
 * @Author xiaxp
 * @Date 2020-08-06T18:39:54.729
 * @Description
 */
public abstract class BaseMessageConsumer implements WorkHandler<TranslatorDataWapper> {

	protected String consumerId;
	
	public BaseMessageConsumer(String consumerId) {
		this.consumerId = consumerId;
	}

	public String getConsumerId() {
		return consumerId;
	}

	public void setConsumerId(String consumerId) {
		this.consumerId = consumerId;
	}

	@Override
	public void onEvent(TranslatorDataWapper event) throws Exception {
		this.handleData(event);
	}

	/** 继承实现数据的处理逻辑
	 * @param translatorDataWapper
	 */
	public abstract void handleData(TranslatorDataWapper translatorDataWapper);
}
